<?php

namespace app\serverfavorite\service\favorite;
use app\manage\service\ApiBase;

/**
 * @author:      李颖
 * @DateTime:    2017-06-12 11:10:09
 * @Description: 收藏分类 app_key为必传字段
 */

class FavoriteCategory extends ApiBase
{
	
	protected $favoriteCategoryLogic = 'app\serverfavorite\logic\FavoriteCategory';
    protected $favoriteCategoryValidate = 'app\serverfavorite\validate\FavoriteCategory';


    /*添加一个收藏分类*/
    public function addCate(): array 
    {
    	$data = $this->haveIssetReceiveData(['pid'=>0,'name'=>' ','profile_pic'=>'','order'=>100,'description'=>'','app_id'=>0,'other_app_read'=>'','is_public'=>0,'action'=>' ']);
        return $this->oneStepRun($data, 'serverfavorite/favorite/FavoriteCategory/addCate', 'addCate');
    }

    /*编辑一个收藏分类*/
    public function editCate(): array 
    {
    	$data = $this->issetReceiveData(['id'=>0,'name'=>' ','profile_pic'=>'','order'=>100,'description'=>'','token'=>' ','other_app_read'=>'','is_public'=>0,'action'=>' ']);
        return $this->stepRun($data, 'serverfavorite/favorite/FavoriteCategory/editCate', 'editCate', 'editCate');
    }

    /*查看该分类详情*/
    public function oneCateInfo(): array 
    {
    	$data = $this->receiveData(['id'=>0, 'token'=>' ']);
        return $this->stepRun($data, 'serverfavorite/favorite/FavoriteCategory/oneCateInfo', 'oneCateInfo', 'oneCateInfo');
    }

    /*查看收藏列表*/
    public function cateList(): array 
    {
        $data = $this->haveIssetReceiveData(['id'=>0, 'token'=>' ']);
        return $this->stepRun($data, 'serverfavorite/favorite/FavoriteCategory/cateList', 'cateList', 'cateList');
    }

    /*查看指定应用下的收藏分类树*/
    public function appCateList(): array 
    {
        $data = $this->haveIssetReceiveData(['id'=>0, 'app_id'=>0]);
        return $this->oneStepRun($data, 'serverfavorite/favorite/FavoriteCategory/cateList', 'cateList');
    }

    /*删除某个收藏分类*/
    public function delOneCate(): array 
    {
    	$data = $this->receiveData(['id'=>0, 'token'=>' ']);
        return $this->stepRun($data, 'serverfavorite/favorite/FavoriteCategory/delOneCate', 'delOneCate', 'delOneCate');
    }

    /*批量删除收藏分类*/
    public function batchDelCate(): array 
    {
    	$data = $this->receiveData(['id'=>[], 'token'=>' ']);
        return $this->stepRun($data, 'serverfavorite/favorite/FavoriteCategory/batchDelCate', 'batchDelCate', 'batchDelCate');
    }

    /*启用/禁用 一个 分类*/
    public function changeStatus(): array 
    {
    	$data = $this->receiveData(['id'=>0,'status'=>' ', 'token'=>' ']);
        return $this->stepRun($data, 'serverfavorite/favorite/FavoriteCategory/changeStatus', 'changeStatus', 'changeStatus');
    }

    /*启用/禁用 多个 分类*/
    public function batchChangeStatus(): array 
    {
    	$data = $this->receiveData(['id'=>[],'status'=>' ', 'token'=>' ']);
        return $this->stepRun($data, 'serverfavorite/favorite/FavoriteCategory/batchChangeStatus', 'batchChangeStatus', 'batchChangeStatus');
    }

    


    

}






